package com.n5x.model.discount;

import java.math.BigDecimal;
import java.util.Date;

public class DiscountCash extends AbstractDiscount {
    private DiscountCash() {
    }

    public DiscountCash(Type type, String name, BigDecimal targetPrice, BigDecimal price, Boolean isShow, Date vaildTime, String content) {
        this.type = type.name();
        this.name = name;
        this.targetPrice = targetPrice;
        this.price = price;
        this.isShow = isShow;
        this.vaildTime = vaildTime;
        this.content = content;
    }

    public enum Type {
        充值优惠, 消费优惠;

        public static Type getType(Integer ordinal) {
            if (ordinal == null) return null;
            int size = Type.values().length;
            if (ordinal < 0 || ordinal > size - 1) return null;
            return Type.values()[ordinal];
        }
    }

    private String type;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}